package com.itheima.reggie.common;/**
 * 功能描述
 *
 * @author 唯硕
 * @date 2022/09/20  18:03
 */

/**
 *@ClassName BaseContext
 *@Description TODO 基于ThreadLocal封装的工具类用于保存和获取当前用户的Id
 *@Author 唯硕
 *@Date 2022/9/20 18:03
 *@Version 1.0
 */
public class BaseContext {
    private  static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static Long getCurrentId() {

        return threadLocal.get();
    }

    public static void setCurrentId(Long id) {
      threadLocal.set(id);
    }
}
